package com.example.util;

import com.example.inter.TeacherPicUtil;
import com.example.inter.UserInfoCallBack;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;

/**
 * Created by Administrator on 2016/4/7.
 */
public class UserInfoTeacher implements TeacherPicUtil {
    @Override
    public void getInfo(String teacher_number, final UserInfoCallBack userInfoCallBack) {
        HttpUtils http = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addBodyParameter("teacher_number", teacher_number);

        http.send(HttpRequest.HttpMethod.POST,
                "http://192.168.191.1/app/index.php/teacher/sel", params,
                new RequestCallBack<String>() {
                    @Override
                    public void onLoading(long total, long current, boolean isUploading) {

                    }

                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        userInfoCallBack.onSuccess(responseInfo.result.toString());
                    }

                    @Override
                    public void onStart() {
                    }

                    @Override
                    public void onFailure(HttpException error, String msg) {
                        userInfoCallBack.onFail();
                    }
                });

    }
}
